let menus = [
  {
    menuName: '菜单',
    menuKey: 'Menus',
    children: [
      {
        menuName: 'TableLayout',
        menuKey: 'tableLayout',
      },
    ],
  },
];
let idIndex = 1;
function createMenuId(menus, pId) {
  menus.forEach((item) => {
    item['id'] = idIndex;
    item['pId'] = pId;
    if (item.children) {
      ++idIndex;
      createMenuId(item.children, item.id);
    } else {
      idIndex++;
    }
  });

  return menus;
}

menus = createMenuId(menus, 0);
export { menus };
